<?php
if($this->session->userdata('role') != null){
	if($this->session->userdata('role') == 1){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<?php
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=".$kuesioner[0]['nama_kuesioner'].".doc");
    header("Pragma: no-cache");
    header("Expires: 0");
?>
<head><style type="text/css"></style></head>
<body leftmargin="50" rightmargin="50" topmargin="-50" bottommargin="0" width: 1344px; height: 842px;  /* to centre page on screen*/ margin-left: auto; margin-right: auto;>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<style>
		table.plainGrid
		{
			background: white;
			border-collapse: collapse;
		}
		
		table.plainGrid td
		{
			border: 1px #000 solid;
			padding: 0.3em;
			font-family:Verdana, Arial, Helvetica, sans-serif;
			font-size: 12px;
		}
		
		table.dataGrid tr
		{
			color:#000;
		}
	</style>
<div class="container-fluid">
			<div>
			<h3 align="center"><?php echo $kuesioner[0]['nama_kuesioner'];?></h3>
			<h4 align="center"><?php echo $kuesioner[0]['deskripsi'];?></h4>
			</div>
			<div class="form-group" style="margin-left:110px">
			<table border="1">
				<?php
				$nomor = 1;
				$skala = array();
				$pg = array();
				foreach($konten_teks as $konten_teks)
				{
						echo '<tr>';
						echo '<td>'.$nomor++.'</td>';
						echo '<td>'.$konten_teks['pertanyaan'].'</td>';
						echo '<td colspan="5">:..................................................</td>';
						echo '</tr>';
				}
				
				foreach($konten_pg as $konten_pg)
						{
							$pg = explode(',', $konten_pg['pilihan']);
									echo '<tr>';
										echo '<td>'.$nomor++.'</td>';
										echo '<td  colspan="2" style="word-wrap: break-word;max-width: 30px;">'.$konten_pg['pertanyaan'].'</td>';
										echo '<td ></td>';
										for($i = 0; $i < count($pg)-1; $i++)
										{
											echo '<td><input type="checkbox">'.$pg[$i].'</td>';
										}
										echo '</tr>';
							
						}
				
				foreach($konten_skala as $konten_skala)
						{
								if(empty($skala)){
									echo '<tr>';
									echo '<td colspan="2"></td>';
									$skala = explode(',', $konten_skala['skala']);
									//var_dump($skala);
									for($i = 0; $i < count($skala)-1; $i++)
									{
										echo '<td >'.$skala[$i].'</td>';
									}
									echo '</tr>';
									echo '<tr>';
										echo '<td>'.$nomor++.'</td>';
										echo '<td style="word-wrap: break-word;max-width: 30px;">'.$konten_skala['pertanyaan'].'</td>';
										for($i = 0; $i < count($skala)-1; $i++)
										{
											echo '<td></td>';
										}
										echo '</tr>';
								} else
									{
										echo '<tr>';
										echo '<td>'.$nomor++.'</td>';
										echo '<td style="word-wrap: break-word;max-width: 30px;">'.$konten_skala['pertanyaan'].'</td>';
										for($i = 0; $i < count($skala)-1; $i++)
										{
											echo '<td></td>';
										}
										echo '</tr>';
									}
							
						}
					
					
				
				?>
			</table>
			</div>
</div>

</body>
</html>
<?php
} else{ 
		echo 'Anda belum login, silahkan login terlebih dahulu dengan klik link berikut';
		echo '<a href="'.base_url('index.php/guest').'">Kembali</a>';
	}
} else
	{
		echo 'Anda belum login, silahkan login terlebih dahulu dengan klik link berikut';
		echo '<a href="'.base_url('index.php/guest').'">Kembali</a>';
	}
	
?>